﻿using Microsoft.Reporting.WinForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Iacym.UI.Reportes
{
    public partial class frmOfrendaTotal : Form
    {
        public DateTime fechaInicio;
        public DateTime fechaFin;

        public frmOfrendaTotal()
        {
            InitializeComponent();
        }

        private void frmOfrendaTotal_Load(object sender, EventArgs e)
        {
            CargarReporte();
        }

        private void CargarReporte()
        {
            reportOfrendaTotal.ShowPageNavigationControls = false;
            reportOfrendaTotal.ShowCredentialPrompts = false;

            var user = ConfigurationManager.AppSettings.Get("userReport");
            var pws = ConfigurationManager.AppSettings.Get("pwsReport");
            reportOfrendaTotal.ServerReport.ReportServerCredentials.NetworkCredentials = new NetworkCredential(user, pws);

            var ipServer = ConfigurationManager.AppSettings.Get("ipServer");
            var path = ConfigurationManager.AppSettings.Get("pathT");
            reportOfrendaTotal.ProcessingMode = ProcessingMode.Remote;
            reportOfrendaTotal.ServerReport.ReportPath = path;
            reportOfrendaTotal.ServerReport.ReportServerUrl = new Uri(ipServer, System.UriKind.Absolute);

            //ReportParameter[] parameters = new ReportParameter[1];
            //parameters[0] = new ReportParameter("IdPersona", IdPersona.ToString());

            //reportOfrendaTotal.ServerReport.SetParameters(parameters);
            this.reportOfrendaTotal.RefreshReport();
        }
    }
}
